const app = getApp()
var template = require('../../template/template.js');
var util = require('../../utils/util.js')
var WxParse = require('../../wxParse/wxParse.js');
Page({
  data: {
    motto: 'Hello World',
    userInfo: {},
    hasUserInfo: false,
    src: '',
    canIUse: wx.canIUse('button.open-type.getUserInfo')
  },
  // addVideo
  addVideo: function() {
    var that = this
    wx.chooseVideo({
      sourceType: ['album', 'camera'],
      maxDuration: 60,
      camera: 'back',
      success: function(res) {      
        that.setData({
          video: res.tempFilePath,
          size: (res.size / (1024 * 1024)).toFixed(2)
        })
      }
    })
  },
 
  onLoad: function() {
    // var tabnum = app.globalData.tabnum  
    //that.gettbanum();
    //template.tabbar("tabBar", 0, this, tabnum),//0表示第一个tabbar
    util.http("https://xcx.chenjiudenanren.com/inter/Sy/home", "", this.connect);

  },
  connect: function(data) {
    console.log(data.affiche)
    this.setData({
      content: data.content,
      tupian1: data.tupian1,
      affiche: data.affiche,
    })
  },
  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function() {

  },

  changeName: function(e) {

    wx.getStorage({
      key: 'tabnum',
      success: function(res) {
        console.log(res.data)
        if (res.data == '1') {
          wx.redirectTo({
            url: '/pages/inspect/inspect'
          })
        } else {
          wx.showToast({
            title: '您没有权限',
            icon: 'loading',
            duration: 1500
          })
        }
      }

    })
    /* wx.redirectTo({       
       url: '/pages/inspect/inspect'
     })*/

  }



})